package cn.mumzone.pos.ui.widgets;

import android.content.Context;
import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.util.AttributeSet;
import android.view.MotionEvent;

/**
 * Created By Dlx
 * on 2019/7/6
 * 当我试图让顶层group负责分发事件，遇到严重问题
 * 改为交由外部recyclerview不拦截事件流并同时自身也相应操作
 */
public class PanelOuterRecyclerView extends RecyclerView {
    public PanelOuterRecyclerView(Context context) {
        super(context);
    }

    public PanelOuterRecyclerView(Context context, @Nullable AttributeSet attrs) {
        super(context, attrs);
    }

    public PanelOuterRecyclerView(Context context, @Nullable AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
    }

    @Override
    public boolean dispatchTouchEvent(MotionEvent ev) {
        onTouchEvent(ev);
        if (MotionEvent.ACTION_POINTER_DOWN == (ev.getAction() & MotionEvent.ACTION_MASK)) {
            return false;
        }
        return super.dispatchTouchEvent(ev);
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent e) {
        return false;
    }
}
